<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>故障定位</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
       <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<link rel="stylesheet" type="text/css" href="css/supportDefineDetail.css" />
</head>
<body>
	<div id="wrap">     
        <div id="sddDivId" style="overflow:auto;margin-bottom:55px;">
        	<div class="cardDiv">
		  		<div class="cardLabel">铁塔确认人：</div>								  	
		  		<div class="cardCon">
		  			<input id="itowerConfirmerId" type="text" style="background-color:#FFFFFF;width:100%;height:100%;line-height:40px;">
		  		</div>
		  	</div>
		  	<div class="cardDiv">
		  		<div class="cardLabel">运营商确认人：</div>								  	
		  		<div class="cardCon">
		  			<input id="operatorConfirmerId" type="text"  style="background-color:#FFFFFF;width:100%;height:100%;line-height:40px;">
		  		</div>
		  	</div>		  	
		  	<div class="cardDiv">
		  		<div class="cardLabel">确认时间：</div>								  	
		  		<div class="cardCon">
		  			<input id="confirmTimeId" type="datetime-local"  style="background-color:#FFFFFF;width:100%;height:100%;line-height:40px;">
		  		</div>
		  	</div>		  	
			<div class="cardDiv">
		  		<div class="cardLabel">故障责任方：</div>					  	
			  	<div class="cardCon">
					<select id="faultDutyId" style="background-color:#FFFFFF;width:100%;height:100%;" value="">
    					<option value="">------请选择------</option>
			            <option value="1">铁塔公司</option>
			            <option value="2">运营商</option>
    				</select>
		  		</div>
		  	</div>
		  	<div class="cardDiv">
		  		<div class="cardLabel">室内故障等级：</div>					  	
			  	<div class="cardCon">
					<select id="faultLevelId" style="background-color:#FFFFFF;width:100%;height:100%;" value="">
        				<option value="">------请选择------</option>
			            <option value="1">一般故障</option>
			            <option value="2">特殊故障</option>
    				</select>
		  		</div>
		  	</div>
		  	<div class="cardTextareaDiv">
		  		<div class="cardTextareaLabel">备注信息：</div>					  	
			  	<div class="cardTextareaCon">
		  			<textarea id="remarkId" rows="4" class="noborder" style="background-color:#FFFFFF;width:100%;height:100%;"></textarea>
		  		</div>
		  	</div>		  	
		  		        
        </div>      		
		<footer style="height:50px;">
			<div class="cardButtonDiv">				
				<button class="cancelBtn"  onclick="closeWin()">取消</button>
				<button class="okBtn"  onclick="confirmFunc();">确定</button>	
			</div>
		</footer>		
	</div>
</body>
<script src="../../script/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script> 
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/client.api.js"></script>
<script type="text/javascript" src="../../script/aui-alert.js"></script>
<script type="text/javascript" src="../../script/debug.js"></script>
<script type="text/javascript">
	apiready = function(){
		api.addEventListener({
		    name:'viewappear'
		},function(ret,err){
		    api.closeFrame({
			    name: 'billMenu'
			});
	
		});	   	    
	    initRelief();	    
	    api.pageParam.supportDefine = true;
	    //status bar style
	    api.setStatusBarStyle({
	        style: 'light'
	    });
	};
	
	//初始化故障定位信息
	function initRelief(){
		var user = $api.getStorage('user');
		var username = user.username;
		if(user!=null && username!=null && username!=""){
			$('#itowerConfirmerId').val(username);
			$('#itowerConfirmerId').attr("readonly","readonly");		
		}
	}
	
	function confirmFunc(){
		var billModel = $api.getStorage('billModel');
		var user = $api.getStorage('user');
		var userId = user.userid;
		var billId = billModel.billid;
		var billSn = billModel.billsn;
		var taskId = billModel.taskid;
		var itowerConfirmPeople = $('#itowerConfirmerId').val();
		var carrierConfirmPeople = $('#operatorConfirmerId').val();
		var confirmTime = $('#confirmTimeId').val();
		var faultDuty = $('#faultDutyId').val();
		var faultLevel = $('#faultLevelId').val();
		var dealResult = $('#remarkId').val();

		if(itowerConfirmPeople==""){
			api.toast({msg: "请输入铁塔确认人",duration:1000, location: 'middle'});
			return;
		}
		if(carrierConfirmPeople==""){
			api.toast({msg: "请输入运营商确认人",duration:1000, location: 'middle'});
			return;
		}
		if(confirmTime==null || confirmTime==""){
			api.toast({msg: "请设置确认时间",duration:1000, location: 'middle'});
			return;
		}
		if(faultDuty==null || faultDuty==""){
			api.toast({msg: "请选择故障责任方",duration:1000, location: 'middle'});
			return;
		}
		if(faultLevel==null || faultLevel==""){
			api.toast({msg: "请选择室内故障级别",duration:1000, location: 'middle'});
			return;
		}
			
		api.showProgress({
			title : '处理中',
			modal : false
		});
		var data = {};
		data.userID = userId;
		data.billSn = billSn;
		data.taskId = taskId;
		data.itowerConfirmPeople = itowerConfirmPeople;
		data.carrierConfirmPeople = carrierConfirmPeople;
		//data.confirmTime = confirmTime;
		data.confirmTime = confirmTime.replace(/T/," ")+":00";
		data.faultDuty = faultDuty;
		data.faultLevel = faultLevel;
		data.dealResult = dealResult;
		
		$client.supportDefine(data, function(ret, err) {
			if (ret) {
				if (ret.success) {
					api.toast({msg: "故障定位成功",duration:1000, location: 'middle'});
					api.execScript({
							name : 'bill-list_win',
							script : 'refreshBillList('+1+');'
						});
					 window.setTimeout(function() {
                    api.closeToWin({
                        name : 'bill-list_win'
                    });
                }, 1100);
				} else {
					api.toast({msg: ret.data_info, location: 'middle'});
				}
			} else {
	            api.toast({msg: err.msg, location: 'middle'});
	        }
			api.hideProgress();
			
		});
	}

	function closeWin(){
		api.closeWin({
			name:'supportDefine_win'
        });
	}
</script>
</html>